package com.upc.tp.timeplanning.mapper;

import com.upc.tp.timeplanning.entity.Parent;
import com.upc.tp.timeplanning.entity.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ParentMapper {

    @Select("SELECT * FROM parent")
    List<Parent> getAll();

    @Select("SELECT * from parent where username = #{username} ")
    Parent getByUsername(@Param("username")String username);

    @Select("SELECT * FROM parent WHERE username = #{username} ")
    List<Parent> showInformation(@Param("username")String username);

    @Insert("INSERT INTO parent(username,password) VALUES(#{username},#{password})")
    int insert(@Param("username")String username, @Param("password")String password);

    @Update("UPDATE parent SET parent_name = #{parent_name},password = #{password} WHERE username = #{username}")
    int update(@Param("parent_name")String parent_name, @Param("password")String password,@Param("username")String username);

    @Update("UPDATE parent SET student_username = #{student_username},student_name = #{student_name} WHERE username = #{username}")
    int bind(@Param("student_username")String student_username,@Param("student_name")String student_name,@Param("username")String username);

}
